<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="../css/aui.2.0.css">
    <link rel="stylesheet" href="../css/homeCommon.css">
    <link rel="stylesheet" href="../css/homePage.css">
    <link rel="stylesheet" href="../css/alert.css">
    <link rel="stylesheet" href="../css/discountMall.css">
</head>
<body>
<header class="aui-bar aui-bar-nav" id="aui-header" style="position:fixed;height:2rem;">
    <div class="aui-col-xs-3 my-col-xs-3" style="width:15%;">
        <i class="aui-iconfont aui-icon-left"></i>
    </div>
    <div class="aui-title my-aui-title">京东</div>
    <div class="aui-col-xs-3" style="float: right;width: 20%;" id="addsearch">
        <i class="aui-iconfont aui-icon-search"></i>
    </div>

</header>
<!--搜索框-->

    <div class="aui-searchbar" id="search" style="height:0;margin-top: 2.2rem;border-top: solid 1px #fff;">
        <div class="aui-searchbar-input aui-border-radius">
            <form class="search-form">
                <i class="aui-iconfont aui-icon-search"></i>
                <input type="search" placeholder="请输入搜索内容" id="search-input" autocomplete="off">
                <div class="aui-searchbar-clear-btn" id="clean-search">
                    <i class="aui-iconfont aui-icon-close"></i>
                </div>
            </form>
        </div>
        <div class="aui-searchbar-btn aui-text-info" tapmode>搜索</div>
    </div>
	<div class="aui-searchbar classify">
		<ul class="classify-ul">
			<!-- <li>测试</li>
			<li>测试</li>
			<li>测试</li>
			<li>测试</li>
			<li>测试</li> -->
		</ul>
	</div>
<nav style="margin-top:4.6rem;">
	<div class="newbox" style="width:100%;"><img src="../images/grab.png"></div>
    <div id="dis-list-vessel"></div>
    <div class="loading">加载更多...</div>
    <div class="no-info">没有更多信息了...</div>
    <div class="footer-height"></div>
    <div class="all-mask"></div>

    <!--立即分享-->
    <section class="wxmass-sends">
        <section class="wxmass-sends-item">

            <ul class="wxmass-item-list">
                <li class="share-firends">
                    <div class="wxmass-item-list-img">
                        <img src="../images/wx.png" alt="">
                        <p style="text-align:center;margin-top: 0.1rem;">微信</p>
                    </div>

                </li>
                <li class="share-firends-quan">
                    <div class="wxmass-item-list-img">
                        <img src="../images/friends.png" alt="">
                        <p style="text-align:center;margin-top: 0.1rem;">朋友圈</p>
                    </div>

                </li>
            </ul>

            <div class="wxmass-item-title"> 取消分享 </div>
        </section>
    </section>
</nav>

<footer class="aui-bar aui-bar-tab" id="footer" style="display:none;">
    <a href="javascript:;">
        <div class="aui-bar-tab-item my-aui-active" tapmode>
            <img class="footer-icon-img" src="../images/JD_click.png" alt="">
            <div class="aui-bar-tab-label">首页</div>
        </div>
    </a>
    <a href="extension.html">
        <div class="aui-bar-tab-item" tapmode>
            <i class="aui-iconfont aui-icon-calendar"></i>
            <div class="aui-bar-tab-label">分享中心</div>
        </div>
    </a>
    <a href="commodity.html">
        <div class="aui-bar-tab-item" tapmode>
            <i class="aui-iconfont aui-icon-cert"></i>
            <div class="aui-bar-tab-label">商品中心</div>
        </div>
    </a>
    <a href="my.html">
        <div class="aui-bar-tab-item" tapmode>
            <i class="aui-iconfont aui-icon-my"></i>
            <div class="aui-bar-tab-label">我</div>
        </div>
    </a>
</footer>
<script type="text/x-handlebars-template" id="discount-list-template">
	
    {{#each list}}
    <a href="javascript:;" class="display-box">
        <div class="dis-list-box" data-id="{{id}}" data-sku="{{sku}}" data-couponurl="{{conUrlB}}">
            <div class="dis-shop-img">
                <!--<img src="../img/grey.gif" data-src="{{mainImageUrl}}" alt="">-->
                <img src="../images/lazy.gif" data-src="{{goodsUrl}}" alt="">
            </div>
            <div class="dis-list-content">
                <div class="dis-shop-detail">

                    <span class="shop-list-name">{{goodsName}}</span>
                </div>
                <!--<div class="dis-price">
                    <span>￥{{conPrice}}</span>
                    <span>￥{{oriPrice}}</span>
                </div>-->
               <div class="sales-price">
                   <div class="dis-sales">
                    <div><span>劵后价：<b>¥{{conPrice}}</b> / <font style="color:#e51c08">赚</font><b>{{commissionProfit}}</b></span></div>
                    <div class="dis-original-price"><span>京东价:¥{{oriPrice}}</span></div>
                    <div class="sales-volume"> <span>销量 : {{totalSales}}</span></div>

                    <!--<span>佣金率 <span>{{splitNumber commission}}%</span></span>
                    <span>京东价:¥{{oriPrice}}</span>
                    <span class="hongbao youhuiquan">红包券 <span>{{conTicketPrice}}</span>元</span>
                    <span class="dis-share" data-id="{{id}}" >分享</span> <span>赚:{{commissionProfit}}元</span>-->
                </div>
                <div class="dis-evaluate" data-id="{{id}}" onclick="getshare('{{id}}')">
                   	<div class="hongbaoprice"><b>{{conTicketPrice}}</b>元</div>
					<div class="dis-share"></div>
                </div>
               </div>

            </div>
        </div>
    </a>
    {{/each}}
</script>
<script type="text/x-handlebars-template" id="discount-classify">
    {{#each data}}
   		<li data_id="{{id}}">{{name}}</li>
    {{/each}}
</script>

<script src="../js/jquery-3.0.0.min.js"></script>
<script src="../js/handlebars-v4.0.10.js"></script>
<script src="../js/config.js"></script>
<script src="../js/api.2.0.js"></script>
<script src="../js/search.js"></script>
<script src="../js/function.js"></script>
<script src="../js/common.js"></script>
<script src="../js/alert.js"></script>
<script src="../js/aui-lazyload.js"></script>
<script src="../js/aui-slide.js"></script>
<script src="../js/jd_index.js"></script>
<script>
	
	
	function getshare(obj){
		
		$.ajax({
            url:C.marketInterface.homeJDShare,
            type:'get',
            dataType:'json',
            data:{
                id:obj,
               token:C.marketToken
            },
           
            success:function (response) {
			   console.log(response)
              if(response.result === 'success'){
                    var data = response.data;
                    console.log(data);
                    $('.wxmass-sends').show();
                    var title = data.title;
                    var content = data.content;
                    var url = data.url;
                    var imgUrl = data.imgUrl;

                    $('.share-firends').bind('click', function (event) {
                        pullProtoShare(event,'1');
                    });

                    $('.share-firends-quan').bind('click', function (event) {
                        pullProtoShare(event,'2');
                    });
                    //取消分享弹框
                    $('.wxmass-item-title').click(function () {
                        $('.wxmass-sends').hide();
                    });

                    function pullProtoShare(event,type) {

                        var shareDate = {
                            postType:'shareProducts',
                            type:type,
                            title:title,
                            content:content,
                            productId:obj,
                            imgUrl:imgUrl,
                            url:url


                        };

                        var ua = navigator.userAgent.toLowerCase();
                        if (/iphone|ipad|ipod/.test(ua)) {
                            iosShare(shareDate);
                            event.stopPropagation();
                        } else {
                            androidShare(JSON.stringify(shareDate));
                            event.stopPropagation();
                        }
                    }

				}
			}
        })
		
	}    //拉取安卓分享
    function androidShare(param) {
        window.huifa.shareProducts(param);
    }

    //拉取iOS分享

    function iosShare(param) {
        window.webkit.messageHandlers.shareProducts.postMessage(param);
    }

</script>
</body>
</html>